package com.ibo.htlivecamera.socket;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;

import java.util.Arrays;

public abstract class SimpleListenerAdapter implements SimpleListener {
    @Override
    public final void action(SimpleEvent event) {
        switch (event.command) {
            case SimpleEvent.CONNECTED:
                onConnect();
                break;
            case SimpleEvent.DISCONNECTED:
                onDisconnect();
                break;
            case SimpleEvent.SET_NAME:
                onSetName(event.param);
                break;
            case SimpleEvent.VOLUME:
                onVolume(NumberUtils.toInt(event.param));
                break;
            case SimpleEvent.CAMERA_ZOOM:
                onCameraZoom(NumberUtils.toInt(event.param));
                break;
            case SimpleEvent.STOP_PUSH:
                onStopPush();
                break;
            case SimpleEvent.START_PUSH:
                onStartPush(event.param);
                break;
            case SimpleEvent.RESTART_SELF:
                onRestartSelf();
                break;
            case SimpleEvent.SET_RATE:
                String[] strings = StringUtils.split(event.param, "*");
                onSetRate(NumberUtils.toInt(strings[0]), NumberUtils.toInt(strings[1]));
                break;
            case SimpleEvent.CAMERA_ROTATE:
                onCameraRotate(StringUtils.left(event.param, 1), NumberUtils.toInt(event.param.substring(1)));
                break;
            case SimpleEvent.START_PLAY:
                onStartPlay(event.param);
                break;
            case SimpleEvent.STOP_PLAY:
                onStopPlay();
                break;
            case SimpleEvent.SHOW_ACTIVITY:
                showActivity();
                break;
            case SimpleEvent.STOP_SELF:
                stopSelf();
                break;
            case SimpleEvent.UPDATE:
                onUpdate(event.getParam());
                break;
             case SimpleEvent.RECAPTURE_CAMERA:
                recaptureCamera();
                break;


        }
    }

    public void recaptureCamera() {

    }

    public void onUpdate(String url) {
    }

    public void stopSelf() {
    }

    public void showActivity() {
    }

    public void onStopPlay() {

    }


    public void onSetRate(int width, int height) {

    }

    public void onCameraRotate(String xyz, int step) {

    }

    public void onStartPlay(String url) {

    }


    public void onConnect() {

    }

    public void onDisconnect() {

    }

    public void onConnectFailed() {

    }

    public void onSetName(String name) {

    }

    public void onVolume(int step) {

    }

    public void onCameraZoom(int step) {
    }

    public void onStopPush() {
    }

    public void onStartPush(String url) {
    }

    public void onRestartSelf() {
    }


}
